from django.db import models
from django.contrib.auth.models import User

from eval_pro.models import *


# Create your models here.
class Department(models.Model):
    name = models.CharField(max_length=100)
    belong_sys = models.ForeignKey(to=EvalSys, related_name='depart_belong')

    def __str__(self):
        return str(self.name)

    class Meta:
        verbose_name_plural = '1.部门'


class People(models.Model):
    belong_user = models.OneToOneField(to=User, related_name='peo_belong')
    # name = models.CharField(max_length=10)
    duty = models.CharField(max_length=20)
    belong_depart = models.ForeignKey(to=Department, related_name='peo_belong')

    def __str__(self):
        return str(self.belong_user)

    class Meta:
        verbose_name_plural = '2.人员'


class Chat(models.Model):
    belong_peo = models.ForeignKey(to=People, related_name='chat_belong')
    to = models.ForeignKey(to=People, related_name='chat_to')
    context = models.CharField(max_length=255)

    def __str__(self):
        return str(self.belong_peo)

    class Meta:
        verbose_name_plural = '3.交流'
